package com.kinghood.productcenter.common.model.enums.base;

import lombok.Getter;

/**
 * 属性值类型枚举
 *
 * @author jp
 * @date 2023/12/27
 */
@Getter
public enum AttributeTypeEnum {
    SYSTEM_PRESET(1, "系统预设"),
    DIY(2, "自定义");

    private Integer code;
    private String name;

    AttributeTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (AttributeTypeEnum myEnum : AttributeTypeEnum.values()) {
            if (myEnum.getCode().equals(code)) {
                return myEnum.getName();
            }
        }
        return null;
    }
}
